/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model.admin;

import JDBCUtil.MyConn;
import java.io.Serializable;
import java.sql.Connection;
import java.sql.PreparedStatement;

/**
 *
 * @author Danh
 */
public class Professional implements Serializable {

    private int ProId;
    private String ProName;
    private boolean ProStatus;
    Connection conn;
    boolean editable=false;

    public boolean isEditable() {
        return editable;
    }

    public void setEditable(boolean editable) {
        this.editable = editable;
    }

    public Professional() {
        try {
            conn = MyConn.getConnection();
        } catch (Exception e) {
        }
    }

    public Professional(String ProName, boolean ProStatus) {
        this.ProName = ProName;
        this.ProStatus = ProStatus;
    }

    public Professional(int ProId, String ProName, boolean ProStatus) {
        this.ProId = ProId;
        this.ProName = ProName;
        this.ProStatus = ProStatus;
    }

    public int getProId() {
        return ProId;
    }

    public void setProId(int ProId) {
        this.ProId = ProId;
    }

    public String getProName() {
        return ProName;
    }

    public void setProName(String ProfName) {
        this.ProName = ProfName;
    }

    public boolean isProStatus() {
        return ProStatus;
    }

    public void setProStatus(boolean ProStatus) {
        this.ProStatus = ProStatus;
    }

    public boolean updateProfessional() {
        try {
            PreparedStatement pstmt = conn.prepareStatement("UPDATE Professional_Types SET Professional_Status=?, Professinal_Name=? WHERE Professional_Id=?");
            pstmt.setBoolean(1, this.ProStatus);
            pstmt.setNString(2, this.ProName);
            pstmt.setInt(3, this.ProId);
            int eu = pstmt.executeUpdate();
            if (eu > 0) {
                return true;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }
}